using UnityEngine;
using System.Collections;

public class particlesScript : MonoBehaviour {
    GameObject attract;
    public float rotateForce = 100f;
    public float rotateSpeed = 1000f;

	// Use this for initialization
	void Start () {
        attract = transform.parent.gameObject;
	}
	
	// Update is called once per frame
	void Update () {
        transform.RotateAround(attract.transform.position, Vector3.up, rotateSpeed * Time.smoothDeltaTime);
	
	}

    void OnParticleCollision(GameObject other)
    {
        Rigidbody body = other.rigidbody;
        if (body)
        {
            Vector3 direction = other.transform.position - transform.position;
            direction = direction.normalized;
            body.AddForce(direction * rotateForce);
        }
    }
}
